﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.plaf.basic.icon {
    import flash.display.*;
    import org.aswing.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;
    import org.aswing.plaf.basic.*;

    public class ScrollBarArrowIcon implements Icon, UIResource {

        protected var direction:Number;
        protected var width:Number;
        protected var height:Number;
        protected var shape:Shape;
        protected var verticle:Boolean;

        public function ScrollBarArrowIcon(_arg1:Number, _arg2:int, _arg3:int){
            this.direction = _arg1;
            this.width = _arg2;
            this.height = _arg3;
            this.shape = this.shape;
            if (Math.abs((_arg1 % Math.PI)) < 0.2){
                this.verticle = false;
            } else {
                this.verticle = true;
            };
            this.shape = new Shape();
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.shape);
        }
        public function getIconWidth(_arg1:Component):int{
            return (this.width);
        }
        public function getIconHeight(_arg1:Component):int{
            return (this.height);
        }
        public function updateIcon(_arg1:Component, _arg2:Graphics2D, _arg3:int, _arg4:int):void{
            var _local11:StyleResult;
            _arg3 = 0;
            _arg4 = 0;
            var _local5:Number = this.width;
            var _local6:Number = this.height;
            this.shape.graphics.clear();
            var _local7:AbstractButton = (_arg1 as AbstractButton);
            _arg2 = new Graphics2D(this.shape.graphics);
            var _local8:IntRectangle = new IntRectangle(_arg3, _arg4, _local5, _local6);
            var _local9:Number = 0;
            if (this.verticle){
                _local9 = (Math.PI / 2);
            } else {
                _local9 = 0;
            };
            var _local10:StyleTune = _arg1.getStyleTune().mide;
            var _local12:ASColor = _arg1.getMideground().changeAlpha(1);
            var _local13:ButtonModel = _local7.getModel();
            var _local14:Boolean = ((_local13.isArmed()) || (_local13.isSelected()));
            if (!_local7.isEnabled()){
                _local12 = _local12.offsetHLS(0, -0.06, -0.03);
                _local10 = _local10.sharpen(0.4);
            } else {
                if (_local14){
                    _local10 = _local10.sharpen(0.8);
                } else {
                    if (_local13.isRollOver()){
                        _local12 = _local12.offsetHLS(0, 0.06, 0);
                    };
                };
            };
            _local11 = new StyleResult(_local12, _local10);
            BasicGraphicsUtils.fillGradientRoundRect(_arg2, _local8, _local11, _local9);
            BasicGraphicsUtils.drawGradientRoundRectLine(_arg2, _local8, 1, _local11, _local9);
            _local8 = _local8.clone();
            _local8.grow(-1, -1);
            var _local15:StyleResult = new StyleResult(_local12, _local10);
            new StyleResult(_local12, _local10).bdark = _local15.cdark.offsetHLS(0, 0.06, 0);
            _local15.blight = _local15.clight.offsetHLS(0, 0.06, 0);
            BasicGraphicsUtils.drawGradientRoundRectLine(_arg2, _local8, 1, _local15, _local9);
            var _local16:SolidBrush = new SolidBrush(_local15.blight);
            var _local17:SolidBrush = new SolidBrush(_local11.blight);
            var _local18:Number = (_local5 / 2);
            var _local19:Number = (_local6 / 2);
            var _local20:Number = Math.round((_local5 / 2));
            if (this.verticle){
                _local19 = (_local19 + 1);
                _arg2.fillPolygon(_local16, BasicGraphicsUtils.getArrowPath(_local20, this.direction, _local18, _local19));
                _local19--;
                _arg2.fillPolygon(_local17, BasicGraphicsUtils.getArrowPath(_local20, this.direction, _local18, _local19));
            } else {
                _local18 = (_local18 + 1);
                _arg2.fillPolygon(_local16, BasicGraphicsUtils.getArrowPath(_local20, this.direction, _local18, _local19));
                _local18--;
                _arg2.fillPolygon(_local17, BasicGraphicsUtils.getArrowPath(_local20, this.direction, _local18, _local19));
            };
        }

    }
}//package org.aswing.plaf.basic.icon 
